module.exports = {
  //开发环境
  dev: {
    db: {
      type: 'postgres',
      host: '120.24.73.193',
      dbname: 'tonydb',
      user: 'tony',
      password: 'wds123'
    }
  },
  //正式环境
  prod: {
    db: {
      type: 'postgres',
      host: 'localhost',
      dbname: 'tonydb',
      user: 'tony',
      password: 'wds123'
    }
  },
  //根据环境变量或者node的启动参数返回不同的数据库配置
  getDB: function () {
    var env = process.env.NODE_ENV;
    if (env == 'production' || env == 'prod') {
      return this.prod.db;
    } else {
      return this.dev.db;
    }
  }
};